package me.luger.project.fof.service;

import me.luger.core.dao.nutz.service.BaseService;
import me.luger.project.fof.entity.Benchmark;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class BenchmarkService extends BaseService<Benchmark> {
    public BenchmarkService(Dao dao) {
        super(dao);
    }

    public List<Benchmark> getAllBenchMark(){
        return this.list();
    }

    public List<Benchmark> getBenchMarkByType(Integer assetStrategyId){
        return this.list(Cnd.where("assetStrategyId","=",assetStrategyId));
    }

    @Cacheable(value = "long_time_cache")
    public Benchmark getBenchmarkByWindCode(String windCode){
        return this.fetchOne(Cnd.where("windCode","=",windCode));
    }
}
